<!DOCTYPE html>  
<html>  
   
    <head>  
        <meta charset="utf-8">  
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  
        <title>HTML5网页如何调用浏览器APP的微信分享功能</title>  
        <meta name="viewport" content="width=device-width, initial-scale=1" />  
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />  
        <link rel="stylesheet" type="text/css" href="css/test.css" />  
        <style type="text/css">  
            html,  
            body {  
                margin: 0;  
                padding: 0;  
            }  
        </style>  
   
    </head>  
   
    <body>  
        <span class="shareBtn" id="toshare">点击分享到</span>  
        <div id="nativeShare"></div>  
        <script type="text/javascript" src="../js/common/jquery-3.3.1.min.js"></script>
        <!--<script type="text/javascript" src="js/nativeShare.js"></script>-->  
        <script type="text/javascript">  
            $("#toshare").bind("click", function() {  
                    var config = {  
                        url: '', //分享url  
                        title: '', //内容标题  
                        desc: '', //描述  
                        img: '', //分享的图片  
                        img_title: '', //图片名称  
                        from: '' //来源  
                    };  
                    var share_obj = new nativeShare('nativeShare', config);  
                    $(".am-share").addClass("am-modal-active");  
                    if ($(".sharebg").length > 0) {  
                        $(".sharebg").addClass("sharebg-active");  
                    } else {  
                        $("body").append('<div class="sharebg"></div>');  
                        $(".sharebg").addClass("sharebg-active");  
                    }  
                    $(".sharebg-active,.share_btn").click(function() {  
                        $(".am-share").removeClass("am-modal-active");  
                        setTimeout(function() {  
                            $(".sharebg-active").removeClass("sharebg-active");  
                            $(".sharebg").remove();  
                        }, 300);  
                    })  
            });  
        </script>  
   
    </body>  
   
</html>